package Test;

import java.util.Scanner;

public class TestArray {
    public static void main(String[] args) {
        Scanner sc=new Scanner(System.in);

        //创建数组
        System.out.print("请输入数组长度：");
        int lenth=sc.nextInt();
        int[] sim=new int[lenth];
        System.out.println();

        //生成数组
        System.out.print("请输入数组内容: ");
        for (int i = 0; i < lenth; i++) {
            sim[i]=sc.nextInt();
        }

        /**
         * 冒泡排序
         */
        for (int i = 0; i < sim.length; i++) {
            for (int j = i+1; j <sim.length ; j++) {
                if (sim[i]>=sim[j]){
                    int temp=sim[i];
                    sim[i]=sim[j];
                    sim[j]=temp;
                }
            }
        }

        for (int i :sim) {
            System.out.print(i+" ");
        }


    }
}
